package com.zhentao.controller;

import com.zhentao.model.common.dtos.ResponseResult;
import com.zhentao.model.common.pojo.users.Users;
import com.zhentao.service.IUsersService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
// @RequestMapping("/users")为该控制器类中的所有方法配置了一个基础的请求路径前缀，即 "/users"
@RequestMapping("/user/user")
public class UserController {
    @Autowired
    public IUsersService iUsersService;
    //        根据id查询用户的信息
    @GetMapping("id")
    public ResponseResult selectbyid(){
        return iUsersService.selectbyid();
    }
    @PostMapping("/registry")
    public ResponseResult registry(@RequestBody Users users){
       return iUsersService.regist(users);
    }

    @GetMapping("/getUserInfo")
    public Users getUserInfo(@RequestParam("userId") Long userId){
        return iUsersService.getById(userId);
    }
}
